package cc.vv.btpartyjob.partymanager.delegate

import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.baselibrary.view.webview.BCWebView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 社区大党委组织查询托管类
 * Created by Chen.qi on 2018/10/24.
 */
class SheHuiZuZhiDetailActivityDelegate : BaseAppDelegate() {


    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_shehui_zuzhi
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_asHz_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_asHz_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 设置组织名称
     */
    fun setZuZhiName(name: String?) {
        val viewStr = getView<TextView>(R.id.tv_asHz_orgName)
        viewStr?.text = name
    }

    /**
     * 设置创建时间
     */
    fun setZuZhiCreateTime(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_asHz_createTime)
        viewStr?.text = str
    }

    /**
     * 负责人姓名
     */
    fun setFuZeRenName(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_asHz_fuZeName)
        viewStr?.text = str
    }

    /**
     * 负责人姓名
     */
    fun setFuZeRenTel(str: String?) {
        val viewStr = getView<TextView>(R.id.tv_asHz_fuZePhone)
        viewStr?.text = str
    }

    /**
     * 简介
     */
    fun setWebViewContentZz(webStr: String?) {
        val webView = getView<BCWebView>(R.id.bwv_asHz_webContent)
        webView?.loadData(webStr, "text/html; charset=UTF-8", null)//这种写法可以正确解码
    }


}